home *** CD-ROM | disk | FTP | other *** search
/ Atari Forever 4 / Atari Forever 4.zip / Atari Forever 4.iso / SERIE_AI / AI_018 / FTPOV22.DOC < prev    next >
Text File  |  1998-03-14  |  13KB  |  308 lines

  1.                          FASTER THAN POV-RAY
  2.                      (at least on most machines)
  3.                                    
  4.                              Version 2.2
  5.                                    
  6.           A modified, sped-up and unofficial version of the
  7.              Persistence of Vision Ray-Tracer Version 2.2
  8.                                    
  9.                                   by
  10.                              Dieter Bayer
  11.             (e-mail: dieter@cip.e-technik.uni-erlangen.de)
  12.                           (CIS: 100255.3074)
  13.  
  14.  
  15. INTRODUCTION
  16.  
  17.      Faster than  POV-Ray (FTPOV-Ray)  speeds  up  calulation  of
  18.      images by  using some  kind of  direction cubes  for primary
  19.      rays (the  vista buffer)  and shadow rays (the light buffer)
  20.      at the  cost of  additional preprocessing  time and  greater
  21.      memory usage. The bounding slab hierarchy used by POV-Ray is
  22.      projected onto the viewing plane and each point light source
  23.      a priori.  Thus the  number of  ray/slab-tests  is  reduced.
  24.      Furthermore some  modules have  been modified  to  eliminate
  25.      unnecessary calculations  and automatic  bounding  has  been
  26.      improved.
  27.  
  28.         The modified  source code  in the archive FTPV21S.ZIP may
  29.      only be  distributed together  with this  text and  the file
  30.      POVLEGAL.DOC that  is part  of the official POV-Ray package.
  31.      To use  the source code you'll need the original POV-Ray 2.2
  32.      distribution.
  33.  
  34.         WARNING!!! If  you use FTPOV-Ray you'll do it at your own
  35.      risk!  And   don't  forget   that  the  POV-Ray  team  isn't
  36.      responsible for this version.
  37.  
  38.         If something remains unclear, please drop me a note and I
  39.      will update this file. Any Comments, benchmark tests, ideas,
  40.      bug reports are also welcomed, especially benchmark tests of
  41.      the three different methods (-um?) (Do they make sense?).
  42.  
  43.  
  44. NEW OPTIONS
  45.  
  46.      The following new options have been added to POV-Ray to make
  47.      things switchable at demand (they are not used by default).
  48.  
  49.      +uvb     Use the vista buffer.
  50.  
  51.      +ulb     Use the light buffer.
  52.  
  53.      +usf     Split unclipped  CSG unions  if their  children are
  54.               finite.
  55.  
  56.      +usi     Split all unclipped CSG unions.
  57.  
  58.      +ubq     Use automatic bounding for quadrics.
  59.  
  60.      +upv     Use  'previewing'  (just  draws  object's  bounding
  61.               rectangles; CSG objects are blue, other objects are
  62.               red).
  63.  
  64.      -um1     Method 1: don't use bounding slabs while descending
  65.               the vista/light  buffer tree.  This may  be  faster
  66.               than method 2 for some scenes and/or machines.
  67.  
  68.      -um2     Method 2:  use bounding  slabs on the leaves (i. e.
  69.               the objects  themselves) of  the vista/light buffer
  70.               tree (default method).
  71.  
  72.      -um3     Use bounding  slabs on all nodes of the vista/light
  73.               buffer. This  may(???) be faster on machines with a
  74.               fast(!!!) floating point unit.
  75.  
  76.         If you  use the  vista and/or  light  buffer  you  should
  77.      always specifiy  +ubq and +usf/+usi. And don't forget to use
  78.      the automatic  bounding slabs  (+mb option)  or neither  the
  79.      vista nor  the light  buffer will be used, regardless of the
  80.      specified options. Just play around with the new options and
  81.      see what happens.
  82.  
  83.  
  84. PROBLEMS, DRAWBACKS, THINGS TO KNOW
  85.  
  86.  
  87.      -  Since I  can't guarantee  that FTPOV-Ray works correct in
  88.         all cases  it's a  good idea  to trace  a  scene  at  low
  89.         resolution with  both POV-Ray  and FTPOV-Ray.  If you get
  90.         (nearly) identical images, you can use FTPOV-Ray (keep in
  91.         mind that things like crand and anti-aliasing jitter lead
  92.         to different results every run).
  93.  
  94.      -  Do NOT  use  bounding  objects  that  do  not  completely
  95.         enclose the bounded objects. Otherwise you will get wrong
  96.         results with  FTPOV-Ray. You  shouldn't even do this with
  97.         POV-Ray, because the results are not predictable (instead
  98.         use clipped_by  and bounded_by, as mentioned in POV-Ray's
  99.         documentation).
  100.  
  101.      -  FTPOV-Ray  splits  unclipped  unions  even  if  they  are
  102.         bounded (if  they aren't part of an intersection or merge
  103.         object  of course).
  104.  
  105.      -  The direction  cube  algorithms  and  the  bounding  slab
  106.         technique heavily  depend on  finite objects.  You should
  107.         use them whenever possible.
  108.  
  109.      -  FTPOV-Ray calculates  a better (but not perfect) bounding
  110.         box around  CSG intersections than POV-Ray does. Thus you
  111.         don't have to bound intersections as long as they contain
  112.         at least  one finite object. Even some intersections that
  113.         weren't boundable  can now  be bounded,  depending on the
  114.         way they  are declared.  Use the normal form for quadrics
  115.         and planes  perpendicular to  the coordinate  axis in the
  116.         object's declaration to get an automatic bound around the
  117.         object. Afterwards  you can  translate, rotate  and scale
  118.         the object as you like.
  119.  
  120.      -  FTPOV-Ray can  bound some  quadric  shapes  if  they  are
  121.         declared in  their normal  form, i. e. f(x,y,z) = A*x*x +
  122.         B*y*y +  C*z*z +  J. It's  the normal  way to declare the
  123.         quadrics in  this form  and translate,  rotate and  scale
  124.         them afterwards  (just look  at SHAPES.INC).  Ellipsoids,
  125.         spheres and  even clipped cylinders and cones can thus be
  126.         bounded. Ellipsoids  (and I  think  cones  and  cylinders
  127.         also)  declared   as  quadric   surfaces  are  faster  to
  128.         intersect than  scaled spheres  (or the new cone/cylinder
  129.         primitive). And  with the new bounding functions quadrics
  130.         will now respond to automatic bounding in most cases.
  131.  
  132.      -  The up, right and direction vectors defined in the camera
  133.         statement have  to be  perpendicular to each other (isn't
  134.         this a  bug in  POV-Ray?). If  you want  to be  sure, use
  135.         look_at as the last vector in the camera definition.
  136.  
  137.  
  138. CHANGES MADE TO POV-RAY MODULES
  139.  
  140.      A little  time can  be saved  by removing some of the vector
  141.      macros used.  The code  might be  easier to  read with these
  142.      macros but  they sometimes  waste time  due  to  unnecessary
  143.      memory transfers  (may depend  on the processor and compiler
  144.      used). A  few  modifications  I  have  made  assume  that  a
  145.      floating  point  multiplication  is  (much)  faster  than  a
  146.      division (true for 387/486/Pentium).
  147.  
  148.      BOUND.C    Made some functions global.
  149.  
  150.      CSG.C      Modified computation of CSG's bounding box to get
  151.                 a tighter bounding box around intersections.
  152.  
  153.      LIGHTING.C Removed some unnecessary calculations.
  154.  
  155.      PARSE.C    Added calls  to the new bounding box function for
  156.                 quadrics  and   the  new   plane's  bounding  box
  157.                 calculation.
  158.  
  159.      POVRAY.C   Added calls  to new  modules  and  code  for  new
  160.                 options.
  161.  
  162.      QUADRICS.C Added inverted flag to quadrics.
  163.  
  164.      RENDER.C   Added calls to new functions.
  165.  
  166.         For further  details look at the source code and read the
  167.      comments.
  168.  
  169.  
  170. FTPOV-RAY'S STATISTIC
  171.  
  172.      After parsing  the image  description and  preprocessing,  a
  173.      statistic about  the current  image is  printed to  standard
  174.      error ouput  (that's normally  the screen;  if you're  using
  175.      previewing you'll  have to  pipe it into a file or you won't
  176.      be able  to read it). This statistic tells you the following
  177.      details about all objects used in the scene.
  178.  
  179.      sum      Total number of objects.
  180.  
  181.      csg      Number of objects used inside a CSG.
  182.  
  183.      infin    Number of  infinite objects.  These objects  do not
  184.               respond to  automatic bounding an should be avoided
  185.               whenever  possible   (using  bounding  objects  may
  186.               help).  Infinite   objects  used  in  CSG  are  not
  187.               counted.
  188.  
  189.      bound    Number of objects used as bounding objects.
  190.  
  191.      clip     Number of objects used as clipping objects.
  192.  
  193.      bounded  Number of bounded objects.
  194.  
  195.      clipped  Number of clipped objects.
  196.  
  197.         For good  performance  you  should  keep  the  number  of
  198.      infinite objects as small as possible.
  199.  
  200.  
  201. WHERE TO GET THE SOURCE CODE FOR FTPOV-RAY (AND POV-RAY 2.2)?
  202.  
  203.      I have  uploaded the  source code and executables for MS-DOS
  204.      to ftp.informatik.uni-oldenburg.de. The archives are:
  205.  
  206.      FTPV21S.ZIP  Contains the source code for FTPOV-Ray.
  207.  
  208.      FTPV21MS.ZIP Contains  the   32bit  executable   for  MS-DOS
  209.                   compiled  with   DJGPP  1.12  (GCC  2.6.0).  It
  210.                   requires a  386/387, 486  (no SX!)  or Pentium.
  211.  
  212.         In addition to the source code for FTPOV-Ray you need the
  213.      original  POV-Ray   source  code  that  are  available  over
  214.      Internet  by   anonymous  FTP   from  alfred.ccs.carleton.ca
  215.      (134.117.1.1). There  you'll also  find most  of the  scenes
  216.      used in the benchmark tests.
  217.  
  218.  
  219. HOW TO COMPILE THE SOURCE CODE?
  220.  
  221.      The source  code for  FTPOV-Ray is compiled in a similar way
  222.      to the  original POV-Ray  source code. You have to make sure
  223.      that the  new files  ADDON?.C are  included in your Makefile
  224.      (they use  ADDON.H), and  the original files are replaced by
  225.      the new ones. To use the new code you'll also have to define
  226.      the flag  'DB_CODE'. You  can use  a compiler switch (e.g. -
  227.      DDB_CODE with  gcc) to  do this  or modify  the file FRAME.H
  228.      (the  line   "#define  DB_CODE"   is  already   included  in
  229.      FRAME.H!).
  230.  
  231.         Besides  the   modifications  and  the  four   new  files
  232.      (ADDON0.C,  ADDON1.C,   ADDON2.C,  ADDON3.C,   ADDON.H)  the
  233.      archive only  contains the  modified files  of  the  POV-Ray
  234.      source code.
  235.  
  236.  
  237. REFERENCES
  238.  
  239.      The following  articles  gave  me  the  ideas  for  the  new
  240.      algorithms:
  241.  
  242.      -  The vista projection was taken from:
  243.  
  244.         A. Hashimoto, T. Akimoto, K. Mase, and Y. Suenaga, "Vista
  245.         Ray-Tracing: High  Speed Ray  Tracing  Using  Perspective
  246.         Projection Image",  New Advances  in  Computer  Graphics,
  247.         Proceedings of  CG International  '89, R. A. Earnshaw, B.
  248.         Wyvill (Eds.), Springer, ..., pp. 549-560
  249.  
  250.      -  The idea for the light buffer was taken from:
  251.  
  252.         E. Haines  and D. Greenberg, "The Light Buffer: A Shadow-
  253.         Testing Accelerator",  IEEE CG&A,  Vol. 6,  No. 9,  Sept.
  254.         1986, pp. 6-16
  255.  
  256.  
  257. HISTORY
  258.  
  259.      Version 1.0
  260.          -  First public release.
  261.  
  262.      Version 2.0
  263.          -  Redesign of the vista buffer and the light buffer.
  264.          -  Fixed some bugs.
  265.          -  Made changes to the readme file.
  266.          -  Made modifications/additions  switchable  at  compile
  267.             time.
  268.          -  Removed object and light source limits.
  269.          -  Made  some   changes  in   QUADRICS.C  (inside  test,
  270.             inverted flag).
  271.          -  Fixed problem  with slow  tracing of unmodified scene
  272.             files (like FISH13.POV or IONIC5.POV).
  273.          -  Added options  to turn the vista and the light buffer
  274.             on/off.
  275.          -  Added options to turn union splitting on/off.
  276.          -  Added a  function  for  automatic  bounding  of  most
  277.             quadric shapes.
  278.          -  Added option  to turn automatic bounding for quadrics
  279.             on/off.
  280.          -  Added option to turn 'previewing' on/off.
  281.          -  Changed   bounding    box    calculation    of    CSG
  282.             intersections.
  283.          -  Changed bounding  box structure  to a  more  suitable
  284.             form.
  285.  
  286.      Version 2.1
  287.          -  Added new method which uses bounding boxes around the
  288.             leafs of  the vista/light tree and the priority queue
  289.             to keep number of ray/object-intersections nearly the
  290.             same compared to POV-Ray 2.2.
  291.          -  Changed the recursion used to descend the vista/light
  292.             buffer tree to a queue.
  293.          -  Added option  to choose  in which way the vista/light
  294.             buffer tree is descended.
  295.          -  Switched back  to original bounding structure because
  296.             different (and  worser) hierarchies were created with
  297.             the new  structure (why  this happend  is  beyond  my
  298.             understanding).
  299.          -  Fixed some bugs.
  300.          -  Sped up creation of vista and light buffer.
  301.          -  Reduced memory used by the light buffer.
  302.  
  303.      Version 2.2
  304.          -  Fixed some bugs.
  305.          -  Use  fixed  ibm.c  so  display autodetection and VESA
  306.             should work now.
  307.  
  308.